import django_filters
from .models import *

class LearnFilter(django_filters.rest_framework.FilterSet):
    """过滤器"""

    nickname = django_filters.CharFilter(lookup_expr='icontains')
    username = django_filters.CharFilter(lookup_expr='icontains')
    phone = django_filters.CharFilter(lookup_expr='icontains')
    userCode = django_filters.CharFilter(field_name='user__code')
    minVip = django_filters.NumberFilter(field_name='vip__grade', help_text="最小级别", lookup_expr='gte')
    minRank = django_filters.NumberFilter(field_name='rank', help_text="最小级别", lookup_expr='gte')
    class Meta:
        model = Learn
        fields = '__all__'